package com.example.demo_mvvm.viewmodel;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.example.demo_mvvm.entity.BaseResponse;
import com.example.demo_mvvm.entity.VideoEntity;
import com.example.demo_mvvm.http.ApiService;
import com.example.demo_mvvm.http.RetrofitManager;
import com.example.demo_mvvm.repository.VideoRepository;

import java.util.List;

/**
 * @author yaotianxue
 * @description
 * @date 2025/1/9
 */
public class VideoViewModel extends ViewModel {
    private VideoRepository videoRepository = new VideoRepository();
    public MutableLiveData<List<VideoEntity>> liveData = new MutableLiveData<>(); //通过livedata


    public void video(int currentPage){
        BaseResponse<List<VideoEntity>> baseResponse = videoRepository.video(currentPage);
        if(baseResponse.getCode() == 200){
            liveData.setValue(baseResponse.getData());
        }
    }
}
